﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Admin_AddFriend : System.Web.UI.Page
{
    AccessDAO dao = new AccessDAO();
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        string name = this.txtInfoItem.Text.ToString();
        string http = this.TextBox1.Text.ToString();
        string ss = "insert into friend(name,http) values('"+name+"','"+http+"')";
        if (!name.Equals("")&&!http.Equals(""))
        {
            
            if (dao.getComm(ss) != 0)
            {
                RegisterStartupScript("check", "<script language='javascript'>alert('添加成功');</script>");
                Server.Transfer("friend.aspx");
            }
            else
            {
                RegisterStartupScript("check", "<script language='javascript'>alert('添加失败');</script>");
            }
           
        }
        else
        {
            RegisterStartupScript("check", "<script language='javascript'>alert('请填写类别名称');</script>");
        }
    }
}
